<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>提醒</title>
  <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css" rel="stylesheet" />
  <style>
    .h-50 {
      height: 50px;
    }
  </style>
</head>

<body>
  <div class="container">
    <div class="h-50"></div>
    <div class="alert alert-success" role="alert">
      <h1>:) <%= msg %>
      </h1>
      <p><a href=<%=url %>> 点击跳转(5秒后自动跳转) </a></p>

    </div>
  </div>
  <script>
    // time必须定义在外面，因为定义在里面就是局部变量
   let time=5
   const timer = setInterval(()=>{
      time--
      if(0==time){
        clearInterval(timer)
        location.href='<%= url %>'
        return
      }
      document.getElementsByTagName('a')[0].innerHTML=`点击跳转(${time}秒后自动跳转)`
   },1000)
   
  </script>
</body>

</html>